package Java学习;

import java.util.ArrayList;
import java.util.Collections;

public class Stream {
    public static void main(String[] args) {
        ArrayList<String> list1 = new ArrayList<>();
        Collections.addAll(list1, "高代起-100", "李柘宏-99", "韩瑞杰-98", "李东键-97", "郭昊-96", "史乃齐-95", "高代起-94");
    /*    list1.stream()
                .filter(name -> name.startsWith("李"))
                .filter(name -> name.endsWith("宏"))
                .forEach(name -> System.out.println(name));*/ //李柘宏
        ArrayList<String> list2 = new ArrayList<>();
        Collections.addAll(list2, "宋雨琦", "小颗粒", "叶舒华", "赵美延", "田小娟");
//        list2.stream().limit(3).forEach(name-> System.out.println(name)); //"宋雨琦", "小颗粒", "叶舒华"
//        list2.stream().skip(1).limit(2).forEach(name-> System.out.println(name));//小颗粒，赵美延
//        list1.stream().distinct().forEach(name-> System.out.println(name));//去重
//        list1.stream().filter(name -> name.startsWith("高")).forEach(name -> System.out.println(name));
        list1.stream().map(name -> Integer.parseInt(name.split("-")[1])).forEach(name -> System.out.println(name));
        java.util.stream.Stream.concat(list1.stream(), list2.stream()).forEach(name -> System.out.println(name));
    }

}
